🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / ui / src / commonMain / kotlin / org / meshtastic / core / ui / component / SharedDialogs.kt
Displaying Raw • Download
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/SharedDialogs.kt 01cd54907d62cd90913d3d071b6bc240cae365ef (01cd5490) Text, 2.08 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.component
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.getValue
Tff7b72import T7ee787androidx.lifecycle.compose.collectAsStateWithLifecycle
Tff7b72import T7ee787org.meshtastic.core.model.ConnectionState
Tff7b72import T7ee787org.meshtastic.core.ui.qr.ScannedQrCodeDialog
Tff7b72import T7ee787org.meshtastic.core.ui.share.SharedContactDialog
Tff7b72import T7ee787org.meshtastic.core.ui.viewmodel.UIViewModel
T8b949e/**
* Shared composable that conditionally renders [SharedContactDialog] and [ScannedQrCodeDialog] when the device is
* connected and requests are pending.
*
* This eliminates identical boilerplate from Android `MainScreen` and Desktop `DesktopMainScreen`.
*/
Tf0883e@Composable
Tff7b72fun Td2a8ffSharedDialogsTb4b4b4(Te6edf3uiViewModelTb4b4b4: Te6edf3UIViewModelTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3connectionState Tff7b72by Te6edf3uiViewModelTb4b4b4.Te6edf3connectionStateTb4b4b4.Te6edf3collectAsStateWithLifecycleTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3sharedContactRequested Tff7b72by Te6edf3uiViewModelTb4b4b4.Te6edf3sharedContactRequestedTb4b4b4.Te6edf3collectAsStateWithLifecycleTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3requestChannelSet Tff7b72by Te6edf3uiViewModelTb4b4b4.Te6edf3requestChannelSetTb4b4b4.Te6edf3collectAsStateWithLifecycleTb4b4b4(Tb4b4b4)
Tff7b72if Tb4b4b4(Te6edf3connectionState Tff7b72=Tff7b72= Te6edf3ConnectionStateTb4b4b4.Te6edf3ConnectedTb4b4b4) Tb4b4b4{
Te6edf3sharedContactRequestedTff7b72?.Te6edf3let Tb4b4b4{
Te6edf3SharedContactDialogTb4b4b4(Te6edf3sharedContact Tff7b72= Tffa657itTb4b4b4, Te6edf3onDismiss Tff7b72= Tb4b4b4{ Te6edf3uiViewModelTb4b4b4.Te6edf3clearSharedContactRequestedTb4b4b4(Tb4b4b4) Tb4b4b4}Tb4b4b4)
Tb4b4b4}
Te6edf3requestChannelSetTff7b72?.Te6edf3let Tb4b4b4{ Te6edf3newChannelSet Tff7b72-Tff7b72>
Te6edf3ScannedQrCodeDialogTb4b4b4(Te6edf3newChannelSetTb4b4b4, Te6edf3onDismiss Tff7b72= Tb4b4b4{ Te6edf3uiViewModelTb4b4b4.Te6edf3clearRequestChannelUrlTb4b4b4(Tb4b4b4) Tb4b4b4}Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s